<cfsilent>
	<cfscript>
	qQuestions = Event.getValue("questions");
	qAnswers = Event.getValue("answers");
	index = 1;
	</cfscript>
</cfsilent>
<cfoutput>
	<form name="frmQuestions" action="#cgi.SCRIPT_NAME#" method="post">
	<input type="hidden" name="event" value="#Event.getValue("xehAnswer")#">

	<cfloop query="qQuestions">
		<cfquery name="qQuestionAnswers" dbtype="query">
			SELECT * FROM qAnswers WHERE question_id = <cfqueryparam cfsqltype="cf_sql_integer" value="#Val(question_id)#">
		</cfquery>
		<cfquery name="qRightAnswers" dbtype="query">
			SELECT * FROM qAnswers 
			WHERE question_id = <cfqueryparam cfsqltype="cf_sql_integer" value="#Val(question_id)#">
			AND is_correct = 1;
		</cfquery>
		
		<cfif qRightAnswers.recordCount gt 1>
			<cfset is_multiple = true>
		<cfelse>
			<cfset is_multiple = false>
		</cfif>
		
		Q#index#: #question# <br />
		<cfloop query="qQuestionAnswers">
			<cfif ListFind(qQuestions.user_answer_ids,answer_id)><cfset selected = "CHECKED"><cfelse><cfset selected = ""></cfif>
			<input type="<cfif is_multiple>checkbox<cfelse>radio</cfif>" name="answer_for_#question_id#" value="#answer_id#" #selected#>
			#answer# <br >
		</cfloop>
		<cfscript>index = index++;</cfscript>
	</cfloop>
	
	If you have finished answering all of the questions, please select "finish" on the selection below: <br />
	<input type="radio" name="action" value="finish" />Finish<br />
	<input type="radio" name="action" value="save" CHECKED  />Save<br />
	<input name="submit" type="submit" value="submit"`>
	
	</form>
</cfoutput>